<template>
  <div class="zong" v-if="Object.keys(commentInfo).length != 0">
    <div class="top"><span>用户评价</span><span>更多</span></div>
    <div class="inf">
      <img :src="commentInfo.user.avatar" alt="" class="head" /><span>{{
        commentInfo.user.uname
      }}</span>
    </div>
    <div class="commen">{{ commentInfo.content }}</div>
    <div class="riqi">
      <span>{{ showDate }}</span>
      <!-- <span>{{ commentInfo.created | showDate }}</span> -->

      <span class="info">{{ commentInfo.style }}</span>
    </div>
    <div v-for="item in commentInfo.images" :key="item">
      <img :src="item" alt="" class="sellxiu" />
    </div>
  </div>
</template>
<script>
import { formatDate } from "commen/date.js";
export default {
  name: "DetailCommentInfo",
  props: {
    commentInfo: {
      type: Object,
      default() {
        return {};
      },
    },
  },
  computed: {
    showDate(valve) {
      valve = this.commentInfo.created;
      //1.将时间戳转化为Date函数
      const date = new Date(valve);
      //2.将Date格式化
      return formatDate(date, "yyyy-MM-dd");
    },
  },
};
</script>
<style scode>
.zong {
  height: inherit;
  background-color: #fff;
  padding-left: 5px;
  padding-right: 5px;
}
.top {
  display: flex;
  height: 40px;
  line-height: 40px;
  font-size: 16px;
  margin-left: 5px;
  margin-right: 5px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}
.top span {
  flex: 1;
  justify-content: space-between;
}
.top span:last-child {
  text-align: right;
  font-size: 13px;
}
.inf {
  height: 60px;
  line-height: 60px;
}
.inf span {
  font-size: 16px;
}
.head {
  width: 30px;
  vertical-align: middle;
  padding-right: 10px;
}
.commen {
  font-size: 13px;
  line-height: 20px;
}
.riqi {
  height: 30px;
  line-height: 30px;
}
.sellxiu {
  width: 100px;
}
.info {
  padding-left: 7px;
}
</style>